<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.model.*" %>  
<%@ page import="com.control.*" %>    

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
String user_num=request.getParameter("number");
String user_pwd=request.getParameter("password");
String user_name=request.getParameter("name");
String user_sex=request.getParameter("sex");
int user_role = Integer.parseInt(request.getParameter("role"));
User user=new User();
UserControl uc=new UserControl();
user.setUsername(user_num);
user.setPassword(user_pwd);
user.setName(user_name);
user.setSex(user_sex);
user.setRole(user_role);
if(uc.insertUser(user))
{
	%>
	<script>
	if(window.confirm("添加成功，是否继续添加？"))
		window.location.href="user_insert.jsp";
	else
		window.location.href="Info_show.jsp";
	</script>
	<%}else{ %>
	<script>
	alert("添加失败！");
	window.location.href="user_insert.jsp";
	</script>
	<%}

	%>


</body>
</html>